	
	function checkResume(){

		if($("#headImageInput").val()!='1'){
			$("#tipsDiv").show();
			goToPosition("nameInput");
			return false;
		}
		
		//基本信息验证
		if(!checkFormTag($("#nameInput"))){
			goToPosition("nameInput");
			return false;
		}
		if(!checkFormNumber($("#ageInput"))){
			goToPosition("nameInput");
			return false;
		}	
		
		if(trim($("#experienceInput").val())==''){
			$("#experienceTips").html($("#experienceInput").attr("tips"));
			$("#experienceInput").addClass("ipt-txt-error");
			$("#experienceTips").removeClass().addClass("form-tips form-tips-error");
			goToPosition("nameInput");
			return false;
		}else{
			$("#experienceTips").html("");
			$("#experienceTips").addClass("form-tips form-tips-ok");
		}
		if(!checkFormPhone($("#phoneInput"))){
			goToPosition("nameInput");
			return false;
		}
		if(!checkFormEmail($("#emailInput"))){
			goToPosition("nameInput");
			return false;
		}		
		
		if(!checkProvince()){
			goToPosition("ageInput");
			return false;
		}else if(!checkCity()){
			goToPosition("ageInput");
			return false;
		}
		
		if(trim($("#expectedJobInput").val())==''){
			$("#expectedJobTips").html($("#expectedJobInput").attr("tips"));
			$("#expectedJobInput").addClass("ipt-txt-error");
			$("#expectedJobTips").removeClass().addClass("form-tips form-tips-error");
			goToPosition("ageInput");
			return false;
		}else{
			$("#expectedJobTips").html("");
			$("#expectedJobTips").addClass("form-tips form-tips-ok");
		}
		if(!checkFormNumber($("#salaryInput"))){
			goToPosition("ageInput");
			return false;
		}				
		//工作经历验证
		var wkValidate = true;
		var wkIDSArray = new Array();
		$("#companyBoxDiv .addbuild").each(function(){
			wkIDSArray.push($(this).attr("companyTagId"));
		});
		if(wkIDSArray.length<1){
			$("#addCompanyTipsDiv").show();
			goToPosition("salaryInput");
			return false;
		}
			
		for(var i=0; i < wkIDSArray.length ; i++ ){
			if(!checkFormTag($("#wkCompany"+wkIDSArray[i])))
				wkValidate = false;
			if(!checkFormTag($("#wkJob"+wkIDSArray[i])))
				wkValidate = false;
			if(!checkFormTag($("#wkFrom"+wkIDSArray[i])))
				wkValidate = false;
			if(!checkFormTag($("#wkEnd"+wkIDSArray[i])))
				wkValidate = false;
		}
		$("#companyTagArray").val(wkIDSArray.toString());
		if(!wkValidate){
			goToPosition("companyBoxDiv");
			return false;
		}		
		
		//教育经历验证
		var eduValidate = true;
		var eduIDSArray = new Array();
		$("#eduBoxDiv .addbuild").each(function(){
			eduIDSArray.push($(this).attr("eduTagId"));
		});
		if(eduIDSArray.length<1){
			goToPosition("companyBoxDiv");
			$("#addEducationTipsDiv").show();
			return false;
		}
		
		for(var i=0; i < eduIDSArray.length ; i++ ){
			if(!checkFormTag($("#eduSchool"+eduIDSArray[i])))
				eduValidate = false;
			if(!checkFormTag($("#eduMajor"+eduIDSArray[i])))
				eduValidate = false;
			
			if(trim($("#eduDegree"+eduIDSArray[i]).val())==''){
				$("#eduDegreeTips"+eduIDSArray[i]).html($("#eduDegree"+eduIDSArray[i]).attr("tips"));
				$("#eduDegree"+eduIDSArray[i]).addClass("ipt-txt-error");
				$("#eduDegreeTips"+eduIDSArray[i]).removeClass().addClass("form-tips form-tips-error");
				eduValidate = false;
			}else{
				$("#eduDegreeTips"+eduIDSArray[i]).html("");
				$("#eduDegreeTips"+eduIDSArray[i]).addClass("form-tips form-tips-ok");
			}
			
			if(!checkFormTag($("#eduFrom"+eduIDSArray[i])))
				eduValidate = false;
			if(!checkFormTag($("#eduEnd"+eduIDSArray[i])))
				eduValidate = false;
		}
		$("#eduTagArray").val(eduIDSArray.toString());
		if(!eduValidate){
			goToPosition("eduBoxDiv");
			return false;
		}
		
		if(!checkURL("#masterpieceInput",1)){
			return false;
		}
		if(!checkURL("#homepageInput",1)){
			return false;
		}
		if(!checkURL("#prdUrlInput",1)){
			return false;
		}
		
		if(trim($("#stateDiv").val())==''){
			$("#stateTips").html($("#stateDiv").attr("tips"));
			$("#stateDiv").addClass("ipt-txt-error");
			$("#stateTips").removeClass().addClass("form-tips form-tips-error");
			return false;
		}else{
			$("#stateTips").html("");
			$("#stateTips").addClass("form-tips form-tips-ok");
		}
		
		if(!checkFormTag($("#projectExperienceInput"))){
			goToPosition("projectExperienceInput");
			return false;
		}
		return true;
	}
	
	function checkProvince(){
		var checkObj = $("#s_province");
		var province =checkObj.val();
		var _tips =  $("#pcTips");
		if(province==''){
			checkObj.addClass("ipt-txt-error");
			 _tips.html(checkObj.attr("tips"));
			 _tips.removeClass().addClass("form-tips form-tips-error");
		 	return false;
		}else{
			 _tips.html("");
			 checkObj.removeClass("ipt-txt-error");
			 _tips.removeClass().addClass("form-tips form-tips-ok");
			 return true;
		}
	}

	function checkCity(){
		var checkObj = $("#s_city");
		var province =checkObj.val();
		var _tips =  $("#pcTips");
		if(province==''){
			checkObj.addClass("ipt-txt-error");
			 _tips.html(checkObj.attr("tips"));
			 _tips.removeClass().addClass("form-tips form-tips-error");
		 	return false;
		}else{
			 _tips.html("");
			 checkObj.removeClass("ipt-txt-error");
			 _tips.removeClass().addClass("form-tips form-tips-ok");
			 return true;
		}
	}
	/**
	* 保存在线简历信息
	*/
	function saveResume(){
		
		//基本信息验证
		if(!checkResume())
			return;
		
		$("#resumeForm").attr("action","/account/resume");
		
		//提交服务器
		var options = {
			dataType:'json',
		 	success: function(data) {
				if('200'==data){
					//注册成功
					//初始化定时器3秒后关闭
					closeResumeTipsPop($("#save_ok_div"),1);
				}else{
					//初始化定时器3秒后关闭
					closeResumeTipsPop($("#save_no_div"),1);		
				}
			}
		};
		$("#resumeForm").ajaxSubmit(options);
	}
	
	//初始化定时器3秒
	var closeTime = 1;   
	function closeResumeTipsWindow(){   
		var timerD =  window.setTimeout('closeResumeTipsWindow()',1000);   
		if(closeTime>0){   
			$(".timeTag").html(closeTime);   
			closeTime --;   
		} else{   
			fn_pop.messageHide($(".m-popA .close"));
			window.clearTimeout(timerD);
			window.location.href="/account/resume";
		}   
	}   

	//关闭提示框
	function closeResumeTipsPop(obj,cTime){
		closeTime = cTime;
		$($(obj)).css({"display":"block"});
		fn_pop.maskShow();
		closeResumeTipsWindow();
	}

	
	/**
	* 预览在线简历信息
	*/
	function preView(){
		//基本信息验证
		if(!checkResume())
			return;
		
		$("#resumeForm").attr("action","/candi/resume/saveTemp.html");
		
		$("#resumeForm").submit();
		
//		//提交服务器
//		var options = {
//			dataType:'text',
//			async:false,
//		 	success: function(data) {
//				if('200'==data){
//					 //var openLink = document.getElementById("preViewA");   
//					// openLink.href = '/candi/resume/view.html';   
//					 //openLink.click();  
//					//$('#form1').submit();
//					// alert("openLink.href="+openLink.href);
//					//showViewPage();
//					//$("#preViewA").trigger("click");
//					window.open("/candi/resume/view.html"); 
//					//window.location.href="/candi/resume/view.html";
//				}else{
//					asyncbox.alert("预览失败，请稍后再试");	    
//				}
//			}
//		};
//		$("#resumeForm").ajaxSubmit(options);
	}

	
	/**
	* 动态工作经历
	*/
	function addCompany(){
		
		$("#addCompanyTipsDiv").hide();
		
		var tagId = new Date().getTime(); 
		var companDiv = "";
		companDiv+="<div class='addbuild' companyTagId='"+tagId+"'>";
		companDiv+="<div class='m-form-b'>";
		companDiv+="<div class='item'>";
		companDiv+="<span class='field'>公司名称</span>";
		companDiv+="<input id='wkCompany"+tagId+"' class='ipt-txt' type='text' value='' name='wkCompany"+tagId+"' onfocus='formTagInit(this)' onblur='checkFormTag(this)' tips='请填写公司名称，例如“深圳聚力创想”'/>";
		companDiv+="<span class='form-tips'></span>";
		companDiv+="</div>";
		companDiv+="<div class='item'>";
		companDiv+="<span class='field'>职位名称</span>";
		companDiv+="<input id='wkJob"+tagId+"' class='ipt-txt' type='text' value='' name='wkJob"+tagId+"' onfocus='formTagInit(this)' onblur='checkFormTag(this)' tips='请填写职位，例如“产品经理”'/>";
		companDiv+="<span class='form-tips'></span>";
		companDiv+="</div>";
		companDiv+="<div class='item'>";
		companDiv+="<span class='field'>工作时间</span>";
		companDiv+="<input style=\"float:left;width:105px\" id='wkFrom"+tagId+"'  name='wkFrom"+tagId+"' class='Wdate' onblur='checkFormTag(this)' onfocus=\"WdatePicker({dateFmt:'yyyyMM',minDate:'1980-11',maxDate:'#F{$dp.$D(\\'wkEnd"+tagId+"\\')||\\'%y-%M\\'}'})\" value='' readonly='readonly' tips='请选择起始时间'>";
		companDiv+="<span  style=\"float:left;margin-top: 8px;\">&nbsp;&nbsp;-&nbsp;&nbsp;</span>";
		companDiv+="<input style=\"float:left;width:105px\" id='wkEnd"+tagId+"'  name='wkEnd"+tagId+"' class='Wdate' onblur='checkFormTag(this)' onfocus=\"WdatePicker({dateFmt:'yyyyMM',minDate:'#F{$dp.$D(\\'wkFrom"+tagId+"\\')}',maxDate:'%y-%M'})\"   value='' readonly='readonly' tips='请选择结束时间'>";
		companDiv+="<span class=\"form-tips\"></span>";
		companDiv+="</div>";
		companDiv+="</div>";
		companDiv+="<i class='del' onclick='javascript:removeCompanyDiv(this)'></i>";
		companDiv+="</div>";
		
		$("#addCompanyDiv").after(companDiv);
	}
	
	/**
	* 工作经历焦点失去
	*/
	function removeCompanyDiv(obj){
		if($("#companyBoxDiv .addbuild").length<=1){
			asyncbox.alert('工作经历至少需要填写一项');
		}else{
			 asyncbox.confirm('你确定要删除该工作经历吗？','',function(action){
					if(action == 'ok'){
						$(obj).parent().remove();;
					}
				});
		}
	}
	
	/**
	* 工作经历焦点区域
	*/
	function companyMourseOver(obj){
		var companyDiv = $(obj);
		companyDiv.removeClass().addClass("addbuild");
		companyDiv.find("i").addClass("del"); 
	}
	
	/**
	* 工作经历焦点失去
	*/
	function companyMourseOut(obj){
		var companyDiv = $(obj);
		companyDiv.removeClass().addClass("yuanbuild");
		companyDiv.find("i").removeClass(); 
		/**companyDiv.find(".ipt-txt").each(function(){
			if($(this).val()==''){
			 	$(this).html("不能为空");
				$(this).removeClass().addClass("form-tips form-tips-error");
			}
 		//});
 		*/
	}
	
	
	
	
	
	function addEducation(){
		
		$("#addEducationTipsDiv").hide();

		var tagId = new Date().getTime(); 
		var educationDiv = "";
		educationDiv+="<div class='addbuild' eduTagId='"+tagId+"'>";
		educationDiv+="<div class='m-form-b'>";
		educationDiv+="<div class='item'>";
		educationDiv+="<span class='field'>学校名称</span>";
		educationDiv+="<input id='eduSchool"+tagId+"' class='ipt-txt' type='text' value='' name='eduSchool"+tagId+"' onfocus='formTagInit(this)' onblur='checkFormTag(this)' tips='请填写学校名，例如“北京大学”'/>";
		educationDiv+="<span class='form-tips'></span>";
		educationDiv+="</div>";
		educationDiv+="<div class='item'>";
		educationDiv+="<span class='field'>学历</span>";
		educationDiv+="<input type='hidden' id='eduDegree"+tagId+"' name='eduDegree"+tagId+"' value=''  tips='请选择学历'/> ";
		educationDiv+="<div class='m-select'>";
		educationDiv+="<div class='select-trig'><span class='select-is'>请选择</span><i class='select-arrow'></i></div>";
		educationDiv+="<div class='select-pop'><div class='select-item' cvalue='专科'>专科</div><div class='select-item' cvalue='本科'>本科</div><div class='select-item' cvalue='硕士'>硕士</div><div class='select-item' cvalue='博士'>博士</div><div class='select-item' cvalue='其他'>其他</div></div>";
		educationDiv+="</div>";
		educationDiv+="<span id='eduDegreeTips"+tagId+"' class='form-tips'>请选择学历</span>";
		educationDiv+="</div>";
		educationDiv+="<div class='item'>";
		educationDiv+="<span class='field'>专业</span>";
		educationDiv+="<input id='eduMajor"+tagId+"' class='ipt-txt' type='text' value='' name='eduMajor"+tagId+"' onfocus='formTagInit(this)' onblur='checkFormTag(this)' tips='请填写专业名称，例如“软件工程”'/>";
		educationDiv+="<span class='form-tips'></span>";
		educationDiv+="</div>";
		educationDiv+="<div class='item'>";
		educationDiv+="<span class='field'>起止时间</span>";
		educationDiv+="<input style=\"float:left;width:105px\" id='eduFrom"+tagId+"'  name='eduFrom"+tagId+"' onblur='checkFormTag(this)' class='Wdate' onfocus=\"WdatePicker({dateFmt:'yyyyMM',minDate:'1980-11',maxDate:'#F{$dp.$D(\\'eduEnd"+tagId+"\\')||\\'%y-%M\\'}'})\"   value='' readonly='readonly' tips='请选择起始时间'>";
		educationDiv+="<span  style=\"float:left;margin-top: 8px;\">&nbsp;&nbsp;-&nbsp;&nbsp;</span>";
		educationDiv+="<input style=\"float:left;width:105px\" id='eduEnd"+tagId+"'  name='eduEnd"+tagId+"' onblur='checkFormTag(this)' class='Wdate' onfocus=\"WdatePicker({dateFmt:'yyyyMM',minDate:'#F{$dp.$D(\\'eduFrom"+tagId+"\\')}'})\"  value='' readonly='readonly' tips='请选择结束时间'>";
		educationDiv+="<span class=\"form-tips\"></span>";
		educationDiv+="</div>";
		educationDiv+="<div class='item' style='min-height: 20px'></div>";
		educationDiv+="</div>";
		educationDiv+="<i class='del' onclick='javascript:removeEducationDiv(this)'></i>";
		educationDiv+="</div>";
		
		$("#addEducationDiv").after(educationDiv);
		
		new simu_select({
			obj : $(".m-select")
		});
	}
	
	

	/**
	* 删除教育经历
	*/
	function removeEducationDiv(obj){
		if($("#eduBoxDiv .addbuild").length<=1){
			asyncbox.alert('教育经历至少需要填写一项');
		}else{
			 asyncbox.confirm('你确定要删除该教育经历吗？','',function(action){
					if(action == 'ok'){
						$(obj).parent().remove();
					}
				});
		}
	}
	
	/**
	* 教育经历焦点区域
	*/
	function eduMourseOver(obj){
		var companyDiv = $(obj);
		companyDiv.removeClass().addClass("addbuild");
		companyDiv.find("i").addClass("del"); 
	}
	
	/**
	* 教育经历焦点失去
	*/
	function eduMourseOut(obj){
		var companyDiv = $(obj);
		companyDiv.removeClass().addClass("yuanbuild");
		companyDiv.find("i").removeClass(); 
		/**companyDiv.find(".ipt-txt").each(function(){
			if($(this).val()==''){
			 	$(this).html("不能为空");
				$(this).removeClass().addClass("form-tips form-tips-error");
			}
 		//});
 		*/
	}